home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ape-ad1a / cdxvbcre.cls < prev    next >
Text File  |  1999-09-20  |  2KB  |  62 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CDXVBCredits"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Const Yspeed = 1 ' Move the credits at the speed of 1 pixel each loop
  15. Const ConstColors = 50 'how many shades of gray do you want to fade in & out
  16. Private C(ConstColors) As Long ' Array of colours (For fading)
  17. Public PosY As Long ' Y starting text position
  18.  
  19. Private Sub Class_Initialize()
  20.   For i = 0 To ConstColors
  21.     ' Greyscale
  22.     'C(i) = RGB(i * Int(256 / ConstColors), i * Int(256 / ConstColors), i * Int(256 / ConstColors))
  23.     
  24.     'green
  25.     'C(i) = RGB(0, i * Int(256 / ConstColors), 0)
  26.     
  27.     'red
  28.     C(i) = RGB(i * Int(256 / ConstColors), 0, 0)
  29.     
  30.     'blue
  31.     'C(i) = RGB(0, 0, i * Int(256 / ConstColors))
  32.   Next i
  33. End Sub
  34.  
  35. Public Sub Draw(hDC As Long, SWidth As Long, SHeight As Long)
  36.   Dim n As Long
  37.   If PosY < -(14 * (UBound(Strings) + 1)) Then PosY = SHeight
  38.   For i = 0 To UBound(Strings)
  39.     If (PosY + (i * 14)) < Int(SHeight / 2) Then
  40.       n = Int(SHeight / 2) - (Int(SHeight / 2) - (PosY + (i * 14)))
  41.       If n >= 0 And n < ConstColors Then
  42.         SetTextColor hDC, C(n)
  43.       Else
  44.         If n < 0 Then
  45.           SetTextColor hDC, C(0)
  46.         Else
  47.           SetTextColor hDC, C(ConstColors)
  48.         End If
  49.       End If
  50.     Else
  51.       n = Int(SHeight - (PosY + (i * 14)))
  52.       If n > 0 And n < ConstColors Then
  53.         SetTextColor hDC, C(n)
  54.       Else
  55.         SetTextColor hDC, C(ConstColors)
  56.       End If
  57.     End If
  58.     TextOut hDC, frmMain.ScaleWidth / 2, (i * 14) + PosY, Strings(i), Len(Strings(i))
  59.   Next i
  60.   PosY = PosY - Yspeed
  61. End Sub
  62.